<template>
  <div class="login-container">
    <div class="loginForm">
      <!-- 左侧 -->
      <div class="form-left">
        <!-- logo -->
        <div class="title">
          <img
            src="http://www-wms-java.itheima.net/img/title.ef005a7a.png"
            alt=""
          />
        </div>
        <!-- 表单 -->
        <el-form
          class="form"
          :model="loginForm"
          :rules="rules"
          ref="loginForm"
          label-width="50px"
        >
          <el-form-item prop="account">
            <div class="user">
              <div class="divimg">
                <img src="" alt="">
              </div>
              <el-input
                type="text"
                v-model="loginForm.account"
                autocomplete="off"
              ></el-input>
            </div>
          </el-form-item>
          <el-form-item prop="password">
            <div class="pwd user">
              <div class="divimg">
                <img src="" alt="">
              </div>
              <el-input
                type="password"
                v-model="loginForm.password"
                autocomplete="off"
                show-password
              ></el-input>
            </div>
          </el-form-item>
        </el-form>
        <!-- 记住密码 -->
        <el-checkbox v-model="checked">记住密码</el-checkbox>
        <!-- 立即登录 -->
        <el-button type="primary" @click="submit">立即登录</el-button>
      </div>
      <!-- 右侧 -->
      <div class="form-right"></div>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      loginForm: {
        account: 'admin',
        password: '111111'
      },
      rules: {
        account: [
          { required: true, message: '请输入账户', trigger: 'blur' }
        ],
        password: [
          { required: true, message: '请输入密码', trigger: 'blur' }
        ]
      },
      checked: false
    }
  },
  methods: {
    async submit () {
      await this.$refs.loginForm.validate()
      this.$message.success('登录成功')
      this.$router.push('/')
    }
  }
}
</script>

<style lang="scss" scoped>
* {
  box-sizing: border-box;
}
.login-container {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  .loginForm {
    width: 958px;
    height: 516px;
    box-shadow: 0 0 20px rgb(93 93 93 / 33%);
    background-color: #fff;
    border-radius: 40px;
    display: flex;
    .form-left {
      width: 398px;
      height: 100%;
      .title {
        margin-left: 124px;
        margin-top: 72px;
        img {
          width: 150px;
          height: 64px;
        }
      }
      .form {
        height: 194px;
        ::v-deep .el-form-item__content {
          margin-left: 0!important;
          .el-form-item__error {
            margin-left: 110px;
          }
        }
        .user {
          display: flex;
          margin-top: 50px;
          margin-left: 59px;
          width: 280px;
          height: 50px;
          .divimg {
            width: 50px;
            height: 50px;
            background: #eae7e7;
            border-radius: 8px 0 0 8px;
            img {
              width: 25px;
              height: 24px;
              margin: 12px 13px;
            }
          }
          .el-input {
            width: 230px;
            height:50px;
            ::v-deep .el-input__inner {
              width: 230px;
              height: 50px;
              background-color: #f8f5f5;
              border-bottom-right-radius: 6;
              border-bottom-left-radius: 0;
              border-top-right-radius: 6;
              border-top-left-radius: 0;
              border: 1px solid #f8f5f5;
            }
          }
        }
        .pwd {
          margin-top: 22px;
        }
      }
      .el-checkbox {
        margin-top: 22px;
        margin-left: 60px;
      }
      .el-button {
        width: 280px;
        height: 50px;
        background: #ffb200;
        border-radius: 8px;
        box-shadow: 0 2px 9px 1px rgb(255 178 0 / 47%);
        font-size: 16px;
        font-weight: 400;
        text-align: center;
        color: #332929;
        line-height: 22px;
        margin-top: 23px;
        margin-left: 59px;
      }
    }
    .form-right {
      flex: 1;
      background-image: url(http://www-wms-java.itheima.net/img/contentBg.1321d126.png);
      background-position: 50%;
      background-repeat: no-repeat;
      background-size: cover;
      width: 560px;
      height: 516px;
    }
  }
}
</style>
